package com.start.shop.api.vo.goods;

import java.util.ArrayList;
import java.util.List;

import com.start.shop.modules.repository.entity.Goods;

import lombok.Data;

@Data
public class IndexVo {
	private String goodsType;
	private int goodsTypeId;
	private List<GoodsItemVo> goodsItem;

	public static IndexVo setData(int goodsTypeId, String goodsType, List<Goods> goods) {
		
		IndexVo indexVo = new IndexVo();
		
		indexVo.setGoodsType(goodsType);
		indexVo.setGoodsTypeId(goodsTypeId);
		
		List<GoodsItemVo> goodsItemVos = new ArrayList<GoodsItemVo>();
		for (int i = 0; i < goods.size(); i++) {
			GoodsItemVo goodsItemVo = GoodsItemVo.setdata(goods.get(i));
			goodsItemVos.add(goodsItemVo);
		}
		
		indexVo.setGoodsItem(goodsItemVos);
		
		return indexVo;
		
	}
}
